<?php
namespace Admin\Controller;
class ArticleController extends CommonController {
	public function add(){
		$user = M('user')->where(array('parent_id'=>1))->select();
		$this->assign('user',$user);
		$this->display();
	}
	//用户分配目的码
    public function allotarticle() {

        $add['user_id'] = $_REQUEST['userid'];
        $add['code'] = $_REQUEST['ids'];
        
        $data = D('codelist')->where("user_id=".$_REQUEST['userid'])->find();
        if (empty($data)) {
        	$edit = D('codelist')->add($add);
        }else{
        	$edit = D('codelist')->where("user_id=".$_REQUEST['userid'])->save($add);
        }
        $this->mtReturn(200, '分配成功！','','forward',cookie('_currentUrl_'));
    }
	
}

?>